import qs from 'qs';

import instance from './request';

//精品推荐
export const JinpinAPI = () => instance.get("/products/recommend");
//热门兑换
export const HotAPI = () => instance.get("/products/hot");
//发送短信
export const SendSMSAPI = (params) =>
  instance.post("/sendSMS", qs.stringify(params));
//手机号验证码登陆验证
export const PhoneLoginAPI = (params) =>
  instance.post("/phoneRegin", qs.stringify(params));
//获取用户信息
export const UserProfilesAPI = () => instance.get("/shop/userProfiles");
//请求商品详情
export const GoodDetailsAPI = (id) => instance.get(`/products/${id}`);
//购物车
export const AddToCartAPI = (params) =>
  instance.post("/shop/carts/add", qs.stringify(params));
//全部商品
export const SearchGoodsAPI = (params) => instance.get("/products", { params });
//查看购物车
export const GetCartAPI = () => instance.get("/shop/carts");
//删除商品
export const DeleteCartsAPI = (id) =>
  instance.delete(`/shop/carts?productIds=${id}`);
